package edu.chinasoft.aop01;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public
class Movie {
    //电影状态state  0不好   1好  2环境差
    private int state;
    private Log log = LogFactory.getLog( Movie.class );
    public void run() throws Exception{
        log.info( "电影开始播放" );
        if (state==0){
            throw new PoorQualityException("电影质量不好，要求退票");
        }else if (state==1){
            log.info( "电影播放中" );
        }else if(state==2){
            throw new PoorEnvironmentException("太吵闹");
        }else {
            throw new Exception( "发生特殊情况。" );
        }
        log.info( "电影播放结束" );
    }

    public
    int getState() {
        return state;
    }

    public
    void setState(int state) {
        this.state = state;
    }

    public
    Log getLog() {
        return log;
    }

    public
    void setLog(Log log) {
        this.log = log;
    }
}
